﻿
using Autofac;
using Com.ArHat.BLL;
using Com.ArHat.IBLL;
using Com.ArHat.Model.Models;

namespace Com.ArHat.Test.Common
{
   public class IocContainer
    {
        private static IocContainer _IOContainer;

        public static IocContainer IOContainer
        {
            get
            {
                if (_IOContainer==null)
                {
                    _IOContainer = new IocContainer();
                }
                return _IOContainer;
            }
        }

        private ContainerBuilder ContainerBuilder;
        public IContainer Container;
        private  IocContainer()
        {
            if (ContainerBuilder == null)
            {
                ContainerBuilder = new ContainerBuilder();
            }
            RegisterModel();
            if (Container==null)
            {
                Container = ContainerBuilder.Build();
            }
        }

        public void RegisterModel()
        {
            ContainerBuilder.RegisterType<UserServices>().As<IUserServices>();
            ContainerBuilder.RegisterType<MenuService>().As<IMenuService>();
        }

        

    }
}
